package member.api;

import cart.api.vo.OrderSubmitVo;
import member.api.vo.MemberInvoiceQueryVo;
import member.api.vo.MemberVo;
import member.model.shop.MemberAddress;
import member.model.shop.MemberInVoice;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import utils.sql.PageVo;

import java.util.List;
import java.util.Map;

/**
 * Created by xiaoqian on 2016/10/9.
 */
public interface MemberInvoinceApi {

    /**
     * 查询所有发票信息
     *
     * @param memberId
     * @return
     */
    public List<MemberInVoice> list(String memberId);

    /**
     * 查询默认发票信息
     *
     * @param memberId
     * @return
     */
    public MemberInVoice defaultInVoice(String memberId);


    /**
     * 新增，或者更新发票信息。更新时不更新旧数据，新增一笔再把旧的数据设置成删除
     *
     * @param InVoice
     * @return
     */
    public MemberInVoice saveOrUpdateInVoice(MemberInVoice InVoice);

    /**
     * 创建订单对应的发票对象
     * @param orderSubmitVo
     * @param memberVo
     * @param memberAddress
     * @return
     */
    public Map createOrderInvoice(OrderSubmitVo orderSubmitVo, MemberVo memberVo, MemberAddress memberAddress);

    /**
     * 删除发票信息
     *
     * @param InVoiceId
     * @return
     */
    public Boolean delete(String InVoiceId);

    /**
     * 后台功能
     * 根据条件查询发票
     *
     * @param invoiceNo
     * @param orderNo
     * @param receiver
     * @param pageable
     * @return
     */
    public PageVo findMemberInvoicePageVo(String invoiceNo, String orderNo, String receiver, Pageable pageable);

    /**
     * 保存导入发票信息
     *
     * @param invoiceNos  导入信息项
     * @param orderNos
     * @param shippingIds
     * @return
     */
    public Map saveInvoince(String[] invoiceNos, String[] orderNos, String[] shippingIds);

    /**
     * 获取导出发票数据
     *
     * @param invoiceIds
     * @param orderIds
     * @return
     */
    public List getExportInfoList(String[] invoiceIds, String[] orderIds);

    public List<MemberInVoice> findByids(String[] ids);

    /**
     * 回填发票配送信息表ID
     * @param memberInvoiceId MemberInvoice表ID，主键
     * @param shippingId ShippingInfo表ID
     */
    public int updateShippingId(String memberInvoiceId, String shippingId);

    /**
     * 批量回填发票配送信息表ID
     * @param memberInvoiceIdShippingIdMap
     *      调用：
     *      Map param = new HashMap();
     *      param.put("memberInvoiceId1", "shippingId1");
     *      param.put("memberInvoiceId2", "shippingId2");
     *      updateShippingIds(param);
     * @return
     */
    public int updateShippingIds(Map<String, String> memberInvoiceIdShippingIdMap);

    /**
     * 使用queryVo进行分页查询
     * @param queryVo
     * @param pageable
     * @return
     */
    public Page<MemberInVoice> queryByMemberInvoicePaged(MemberInvoiceQueryVo queryVo, Pageable pageable);

    public String toString();

}
